package com.atguigu.webdemo.service.impl;

import com.atguigu.webdemo.bean.Customer;
import com.atguigu.webdemo.mapper.CustomerMapper;
import com.atguigu.webdemo.service.CustomerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CustomerServiceimpl extends ServiceImpl<CustomerMapper,Customer> implements CustomerService {

    @Autowired
    CustomerMapper customerMapper;
    @Override
    public Customer getCustomer(String id) {
        //Customer customer=new Customer(id,"zhangsan",20);

        //return customerMapper.selectCustomer(id);
        return customerMapper.selectById(id);
    }

    @Override
    public void insertCustomerService(Customer customer) {
        //customerMapper.insertCustomer(customer);
        customerMapper.insert(customer);
    }

    @Override
    public void updateCustomerService(Customer customer){
        //customerMapper.updateCuseomer(customer);
        customerMapper.updateById(customer);
    }

    @Override
    public void deleteCustomerService(String id) {
       // customerMapper.deleteCustomer(id);
        customerMapper.deleteById(id);
    }
}
